class scale9gird extends egret.DisplayObjectContainer{
	public constructor() {
		super();
		this.addEventListener( egret.Event.ADDED_TO_STAGE, this.onAddToStage, this);
	}
	
	private onAddToStage( event: egret.Event ){
		RES.addEventListener(RES.ResourceEvent.CONFIG_COMPLETE, this.configEvent, this);
		RES.loadConfig("/resource/testGrid.res.json","/resource/");
	}

	private configEvent( event: egret.Event ){
		RES.removeEventListener(RES.ResourceEvent.CONFIG_COMPLETE, this.configEvent, this);
		RES.addEventListener(RES.ResourceEvent.GROUP_COMPLETE, this.onGroupComp, this);
		RES.loadGroup("preload");
	}

	private onGroupComp(){
		var img: egret.Bitmap = new egret.Bitmap();
		img.texture = RES.getRes("1_jpg");
		//img.width *= 2;
		this.addChild(img);
		var img2: egret.Bitmap = new egret.Bitmap();
		img2.texture = RES.getRes("1_jpg");
		var rect: egret.Rectangle = new egret.Rectangle(10,20,0,60);
		img2.scale9Grid = rect;
		//img2.width *= 2
		img2.y = 400;
		this.addChild(img2);
	}
}